package com.symria.system.email;

import java.io.File;
import java.util.List;

import com.symria.role.util.Logger;
/**
 * @author 开取线程发送多封邮件
 *
 */
public class EmailSenderRunnable implements Runnable {
	private final Logger logger = Logger.getLogger(EmailSenderRunnable.class);
    private List<String> list = null;
    private String from = null;
    private String subject = null;
    private String content = null;
    private File[] files = null;
    private String type = null;
    private EmailSender send = null;
    EmailSenderRunnable(){}
    EmailSenderRunnable(List<String> list,EmailSender send,String subject,String from,String content,File[] files,String type){
       this.list = list;
       this.send = send;
       this.from = from;
       this.content = content;
       this.subject = subject;
       this.files = files;
       this.type = type;
    }
	@Override
	public void run() {
       if("TEXT".equals(type)){
    	   send.sendTextMail((String[]) list.toArray(new String[0]), subject, content, files);
    	   logger.logInfo("send group email size:"+list.size());
       }else{
    	   send.sendHtmlMail((String[]) list.toArray(new String[0]), subject, content, files);
           logger.logInfo("send group email size:"+list.size());
       }
	}

}
